Imports Clo = Enhancements.Core.Logging
Imports Fun = Enhancements.Basic.Expressions.Functions
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic.Expressions
    ''' <summary>The exception that is thrown when an expression's subexpression token type is not valid.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class CompilerExpressionSubexpressionTokenTypeIsValidNotException
        Inherits CompilerException

        Private Sub New(ByVal _token As Token, ByVal _tokenType As Sys.Type)
            Token = _token
            TokenType = _tokenType
        End Sub

        Private __Token As Token = Nothing
        ''' <summary>Gets the token that caused this exception.</summary>
        Public Property Token() As Token
            Get
                Return __Token
            End Get
            Private Set(ByVal _value As Token)
                __Token = _value
            End Set
        End Property

        Private __TokenType As Sys.Type = Nothing
        ''' <summary>Gets the token type that caused this exception.</summary>
        Public Property TokenType() As Sys.Type
            Get
                Return __TokenType
            End Get
            Private Set(ByVal _value As Sys.Type)
                __TokenType = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_token">Token that is causing the exception.</param>
        ''' <param name="_tokenType">Token type that is causing the exception.</param>
        ''' <exception cref="CompilerExpressionSubexpressionTokenTypeIsValidNotException"> </exception>
        Friend Shared Sub ___Throw(ByVal _token As Token, ByVal _tokenType As Sys.Type)
            Dim _exception As CompilerExpressionSubexpressionTokenTypeIsValidNotException = New CompilerExpressionSubexpressionTokenTypeIsValidNotException(_token, _tokenType)

            Throw _exception
        End Sub

    End Class
End Namespace
